﻿
Partial Class qmg2
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Response.Write("ActionScript,ActionScript,AppleScript,Asp,BASIC,C")
        Dim q, tbl As String
        Dim dt As Data.DataTable
        Dim row As Data.DataRow
        Dim i As Integer
        Dim lst As New System.Collections.Generic.List(Of String)
        q = Request.QueryString("q")
        tbl = Request.QueryString("t")
        If (q = Nothing) Then
            Exit Sub
        End If
        If (tbl = Nothing) Then
            Response.Write(String.Format("{0}|{1}", "No match", "No match"))
            Exit Sub
        End If
        dt = Utility.GetProduct2(q.ToUpper(), tbl.ToUpper())        
        For Each row In dt.Rows
            i = i + 1
            lst.Add(String.Format("{0}|{1}", row(0), row(1)))
            If (i = 10) Then
                Response.Write(String.Join(Environment.NewLine, lst.ToArray()))
                Exit Sub
            End If
        Next
        If (lst.Count > 0) Then
            Response.Write(String.Join(Environment.NewLine, lst.ToArray()))
        End If
    End Sub
End Class
